package com.shenmazong.servereduuser.controller;

import com.shenmazong.servereduuser.service.TbStudentService;
import com.shenmazong.utils.ResultResponse;
import com.shenmazong.vo.AdminVo;
import com.shenmazong.vo.CollageVo;
import com.shenmazong.vo.ListParamVo;
import com.shenmazong.vo.StudentVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 军哥
 * @version 1.0
 * @description: TODO
 * @date 2021/9/22 16:46
 */

@Api(tags = {"学生API接口"})
@RestController
@Slf4j
@RequestMapping(value = "/student")
public class TbStudentController {

    @Autowired
    TbStudentService tbStudentService;

    @ApiOperation(value="增加学生", notes="增加学生", produces="application/json")
    @PostMapping(value = "/add")
    public ResultResponse add(@RequestBody StudentVo student) {
        return tbStudentService.add(student);
    }

    @ApiOperation(value="删除学生", notes="删除学生", produces="application/json")
    @PostMapping(value = "/del")
    public ResultResponse del(@RequestBody StudentVo student) {
        return tbStudentService.del(student);
    }

    @ApiOperation(value="获取学生信息", notes="获取学生信息", produces="application/json")
    @PostMapping(value = "/get")
    public ResultResponse get(@RequestBody StudentVo student) {
        return tbStudentService.get(student);
    }

    @ApiOperation(value="修改学生", notes="修改学生信息", produces="application/json")
    @PostMapping(value = "/set")
    public ResultResponse set(@RequestBody StudentVo student) {
        return tbStudentService.set(student);
    }

    @ApiOperation(value="分页获取学生信息", notes="分页获取学生信息", produces="application/json")
    @PostMapping(value = "/page")
    public ResultResponse page(@RequestBody ListParamVo param) {
        return tbStudentService.page(param);
    }

    @ApiOperation(value="学生登录", notes="学生登录", produces="application/json")
    @PostMapping(value = "/login")
    public ResultResponse login(@RequestBody StudentVo student) {
        return tbStudentService.login(student);
    }
}
